﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Web.Mvc;


namespace BskLeague.Models
{
    public class SampleData : DropCreateDatabaseAlways<BskLeagueDB>  // DropCreateDatabaseIfModelChanges<BskLeagueDB> lub DropCreateDatabaseAlways<BskLeagueDB>
    {
        protected override void Seed(BskLeagueDB _db)
        {
            var seasonStatuses = new List<SeasonStatus>
            {
                new SeasonStatus { Status = "Rekrutacja", StatusId = 1 },
                new SeasonStatus { Status = "Aktywny", StatusId = 2 },
                new SeasonStatus { Status = "Zakończony", StatusId = 3 }
            };
            foreach (var ss in seasonStatuses)
            {
                _db.SeasonStatuses.Add(ss);
            }

            var seasons = new List<Season>
            {
                new Season { SeasonName = "2010/2011", Status=seasonStatuses[2]},
                new Season { SeasonName = "2011/2012", Status=seasonStatuses[1]}
            };
            foreach (var s in seasons)
            {
                _db.Seasons.Add(s);
            }

            var licences = new List<Licence>
            {
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
                new Licence {  SeasonExp = seasons[0]},
            };

            foreach (var l in licences)
            {
                _db.Licences.Add(l);
            }

            var players = new List<Player> 
            {
                new Player {PlayerName="Antoni",              PlayerSurname="Kowalski",   Licence=licences[0],  PlayerNumber=1,     Height=160,    Weight=90,    Email="antekk@xyz.com", UserName="antekk@xyz.com", Date = new DateTime(1988, 03, 03), Photo="/Content/images/user_photo/user_1.jpg", About="Cześć, nazywam się Antek. Jestem wegetarianinem, dlatego uwielbiam herbatę, jeżdżę konno oraz studiuję religioznastwo. Walczę o pokój na świecie oraz równouprawnienie kobiet!" },
                new Player {PlayerName = "Piotr",             PlayerSurname="Czajkowski", Licence=licences[1],  PlayerNumber=12,    Height=205,    Weight=85,    Email="bronio@xyz.com", UserName="bronio@xyz.com", Date = new DateTime(1994, 05, 12), Photo="/Content/images/user_photo/user_2.jpg", About="Witam, pozdrawiam i się kłaniam"},
                new Player {PlayerName = "Czesław",           PlayerSurname="Niemen",     Licence=licences[2],  PlayerNumber=7,     Height=198,    Weight=90,    Email="CON@xyz.com",    UserName="CON@xyz.com",    Date = new DateTime(1970, 06, 02), Photo="/Content/images/user_photo/user_3.jpg", About="Mój numer gg: xxxxxxxx, tel kom. xxx-xxx-xxx"},
                new Player {PlayerName = "Jórek",             PlayerSurname="Murek",      Licence=licences[3],  PlayerNumber=2,     Height=186,    Weight=93,    Email="JN@xyz.com",     UserName="JN@xyz.com",     Date = new DateTime(1981, 12, 01)},
                new Player {PlayerName = "Mudżahid",          PlayerSurname="Aghbafar",   Licence=licences[4],  PlayerNumber=3,     Height=215,    Weight=95,    Email="RS@xyz.com",     UserName="RS@xyz.com",     Date = new DateTime(1985, 01, 31)},
                new Player {PlayerName = "Jurand",            PlayerSurname="Sówka",      Licence=licences[5],  PlayerNumber=10,    Height=201,    Weight=60,    Email="JJ@xyz.com",     UserName="JJ@xyz.com",     Date = new DateTime(1978, 12, 24)},
                new Player {PlayerName = "Zygfryd",           PlayerSurname="Gromowładny",Licence=licences[6],  PlayerNumber=4,     Height=166,    Weight=59,    Email="BB@xyz.com",     UserName="BB@xyz.com",     Date = new DateTime(1976, 11, 23)},
                new Player {PlayerName = "Terry",             PlayerSurname="Hogan",      Licence=licences[7],  PlayerNumber=7,     Height=154,    Weight=61,    Email="AB@xyz.com",     UserName="AB@xyz.com",     Date = new DateTime(1911, 10, 22)},
                new Player {PlayerName = "Aleksiej",          PlayerSurname="Markow",     Licence=licences[8],  PlayerNumber=6,     Height=169,    Weight=63,    Email="CC@xyz.com",     UserName="CC@xyz.com",     Date = new DateTime(1945, 09, 14), Photo="/Content/images/user_photo/user_3.jpg"},
                new Player {PlayerName = "Kim",               PlayerSurname="Young-sook", Licence=licences[9],  PlayerNumber=8,     Height=173,    Weight=62,    Email="LB@xyz.com",     UserName="LB@xyz.com",     Date = new DateTime(1971, 08, 13)},
                new Player {PlayerName = "Ivan",              PlayerSurname="Funalot",    Licence=licences[10], PlayerNumber=1,     Height=170,    Weight=58,    Email="IF@xyz.com",     UserName="IF@xyz.com",     Date = new DateTime(1972, 07, 16)},
                new Player {PlayerName = "Alosza",            PlayerSurname="Awdiejew",   Licence=licences[11], PlayerNumber=13,    Height=165,    Weight=67,    Email="AA@xyz.com",     UserName="AA@xyz.com",     Date = new DateTime(1984, 06, 11)},
                new Player {PlayerName = "Janusz",            PlayerSurname="Środa",      Licence=licences[12], PlayerNumber=13,    Height=154,    Weight=74,    Email="JS@xyz.com",     UserName="JS@xyz.com",     Date = new DateTime(1985, 05, 07)},
                new Player {PlayerName = "Janusz",            PlayerSurname="Palipies",   Licence=licences[13], PlayerNumber=13,    Height=154,    Weight=74,    Email="Palipies@xyz.com",     UserName="Palipies@xyz.com",     Date = new DateTime(1985, 05, 07), Photo="/Content/images/user_photo/14.jpg"},
                new Player {PlayerName = "Donald",            PlayerSurname="Musk",       Licence=licences[14], PlayerNumber=10,    Height=201,    Weight=60,    Email="Pilkarz@xyz.com",     UserName="Pilkarz@xyz.com",     Date = new DateTime(1978, 12, 24), Photo="/Content/images/user_photo/15.jpg"},
                new Player {PlayerName = "Marcin",            PlayerSurname="Majnan",     Licence=licences[15], PlayerNumber=4,     Height=166,    Weight=59,    Email="BachNaMate@xyz.com",     UserName="BachNaMate@xyz.com",     Date = new DateTime(1976, 11, 23), Photo="/Content/images/user_photo/16.jpg"},
                new Player {PlayerName = "Mariusz Max",       PlayerSurname="Golonko",    Licence=licences[16], PlayerNumber=7,     Height=154,    Weight=61,    Email="MMG@bostonmaseczjusets.com",     UserName="MMG@bostonmaseczjusets.com",     Date = new DateTime(1911, 10, 22), Photo="/Content/images/user_photo/17.jpg"},

            };
            foreach (var p in players)
            {
                _db.Players.Add(p);
            }
            //Tu trochę nie ogarniam. Nie mogę użyć użyć "teams", bo obiekt nie jest jeszcze zdefiniowany ( czego nie rozumiem, skoro wszystko zawira się w jednej klasie).
            //Jeśli odwrócę kolejność tworzenia List, to i tak poniższy sposób przypisywania drużyn się wysypuje. Mam nadzieję, że pomożecie mi to wytłumaczyć.
            //new Player {PlayerName = "Antek",   PlayerSurname="Kowalski",   PlayerNumber=1,     Height=160,    Weight=90,    Email="antekk@xyz.com",    _Team=teams.Single(t=>t.TeamName=="Pogoń")},

            //Rak: Ze względu na wielosezonowość nie można bezpośredino w playerze ustawić relacji do Teamu - sql pada, bo w czasie generowania np: IList<Player> players = _db.Players.ToList<Player>();
            //dwukrotnie odwołuje sie do tabeli "Team" /raz przy Team i raz przy SeasonTeamPlayer/, co uznaje za pętle i dziękuje.
            //Zaimplementowałem gettera do property "Team" szukającej po bazie aktualnego teamu playera (dla historycznych graczy zwróci null; jeszcze myślę nad lepszym rozwiązaniem) na podstawie tabeli SeasonTeamPlayer.
            //Dzięki temu nie mamy redundancji danych, a mamy łatwe chodzenie od playera do jego teamu.
            var teams = new List<Team>
            {
                new Team {TeamName = "Pogoń",  ChefPlayer=players[0], TshirtColorPrimary="Żółty", TshirtColorSecondary="Biały", Description="Nasz klub istnieje od roku 748. Nasi zawodnicy ciężko pracują na wspólny sukces, a w wolnych chwilach doskonalą wschodnie sztuki walki."},
                new Team {TeamName = "Śląsk",  ChefPlayer=players[4], TshirtColorPrimary="Zielony", TshirtColorSecondary="Czarny", Description="Mamy świetnych zawodników, dzięki którym warto oglądać nasze mecze, jednak wszystkie sukcesy zawdzięczamy naszym sponsorom: firmie Dachpol, PolBudEx, BudPolEx oraz OknaMarcin."},
                new Team {TeamName = "Legia",  ChefPlayer=players[8], TshirtColorPrimary="Różowy", TshirtColorSecondary="Ciemny różowy", Description="Determinacja, wytrwałość, wysiłek oraz pasja - te 3 słowa najlepiej oddają cechy naszej drużyny. Sprzedam Opla."},
                new Team {TeamName = "Widzew", ChefPlayer=players[2], TshirtColorPrimary="Czerwień", TshirtColorSecondary="Czerwień i Zieleń", Description="W tym sezonie nie popełnimy ubiegłorocznych błędów i nie pozwolimy sobie na żadną porażkę. Zamierzamy wygrać wszystkie spotkania i nie będzie z nami lekko."},
                new Team {TeamName = "Wisła",  ChefPlayer=players[3], TshirtColorPrimary="Koperkowy brąz", TshirtColorSecondary="Szkarłatne osocze", Description="Zapraszamy na nasze mecze i sparingi. Albo tylko na mecze, bo na sparingach nie ma cheerleaderek. Wisła!"},
                new Team {TeamName = "Amika",  ChefPlayer=players[13], TshirtColorPrimary="Muślinowy Turkus", TshirtColorSecondary="Jaskrawy Żakard", LogoFileName="/Content/images/team_logos/5.jpg", Description="Damski klub sportowy Amika zaprasza. Ogólnie to interesują nas chłopaki, dyskoteki i \"takie takie\", ale w miarę to nauka nas najbardziej kręci i mamy nadzieję na ppppprzyszłość!"},
                new Team {TeamName = "Asseco",  ChefPlayer=players[16], TshirtColorPrimary="Cytrynowy Tiul", TshirtColorSecondary="Limonkowa Tafta", LogoFileName="/Content/images/team_logos/6.jpg", Description="Nasz klub jest kontynuatorem założonego w 1974 roku Klubu Piłki Ręcznej przy ZEM „Elmot” Świdnica. Klub prowadzi sekcję piłki koszykowej mężczyzn. Upowszechnia on kulturę fizyczną połączoną dobrą zabawą. Zapraszamy na treningi."}
            };
            foreach (var t in teams)
            {
                _db.Teams.Add(t);
            }

            var stadiums = new List<Stadium>
            {
                new Stadium {
                    stadiumName = "Szkoła podstawowa nr 63",
                    stadiumAddressStreet = "Mennicza 21/23",
                    stadiumAddressCity = "Wrocław",
                    stadiumPosX = 17.032628059387207,
                    stadiumPosY = 51.10653993002722,
                    stadiumPhotoUrl = "http://www.zs1.lazy.pl/fp-content/images/zdjecie-budynku-szkoly-odnowionego.jpg",
                    stadiumActive = true
                },
                new Stadium {
                    stadiumName = "Szkoła podstawowa nr 12",
                    stadiumAddressStreet = "Janiszewskiego 14",
                    stadiumAddressCity = "Wrocław",
                    stadiumPosX = 17.0619159,
                    stadiumPosY = 51.1109835,
                    stadiumPhotoUrl = "http://wroclaw.fotopolska.eu/foto/80/80395.jpg",
                    stadiumActive = true
                }

            };

            foreach (var stadium in stadiums)
            {
                _db.Stadiums.Add(stadium);
            }

            var matchs = new List<Match>
            {
                new Match {Team1=teams[0], Team2=teams[1], FinalScore1 = 34, FinalScore2 = 32, Date = new DateTime(2011, 03, 22), Season = seasons[0], Confirmed1=true, Confirmed2=true , Round=1, Place=stadiums[0]},
                new Match {Team1=teams[0], Team2=teams[2], FinalScore1 = 24, FinalScore2 = 32, Date = new DateTime(2011, 03, 23), Season = seasons[0], Confirmed1=true, Confirmed2=true,Round=2, Place=stadiums[1] },
                new Match {Team1=teams[1], Team2=teams[0], FinalScore1 = 54, FinalScore2 = 32, Date = new DateTime(2011, 03, 11), Season = seasons[0], Confirmed1=true, Confirmed2=true,Round=2, Place=stadiums[0]},
                new Match {Team1=teams[1], Team2=teams[2], FinalScore1 = 26, FinalScore2 = 32, Date = new DateTime(2011, 03, 25), Season = seasons[0], Confirmed1=true, Confirmed2=true, Round=2, Place=stadiums[1]},
                new Match {Team1=teams[2], Team2=teams[0], FinalScore1 = 29, FinalScore2 = 32, Date = new DateTime(2011, 04, 28), Season = seasons[0], Confirmed1=false, Confirmed2=true,Round=3, Place=stadiums[0]},
                new Match {Team1=teams[2], Team2=teams[1], FinalScore1 = 43, FinalScore2 = 32, Date = new DateTime(2011, 05, 30), Season = seasons[0], Confirmed1=true, Confirmed2=false,Round=3, Place=stadiums[1]} ,
               // new Match {Team1=teams[2], Team2=teams[1], Date = new DateTime(2011, 02, 01), Season = seasons[0], Confirmed1=false, Confirmed2=false, Place=stadiums[0]},
                new Match {Team1=teams[3], Team2=teams[5], FinalScore1 = 63, FinalScore2 = 57, Date = new DateTime(2011, 02, 11), Season = seasons[0], Confirmed1=true, Confirmed2=false,Round=4, Place=stadiums[1]} ,
                new Match {Team1=teams[3], Team2=teams[5], FinalScore1 = 52, FinalScore2 = 48, Date = new DateTime(2012, 02, 11), Season = seasons[1], Confirmed1=true, Confirmed2=false,Round=4, Place=stadiums[1]} ,
                new Match {Team1=teams[5], Team2=teams[1], FinalScore1 = 43, FinalScore2 = 36, Date = new DateTime(2011, 05, 30), Season = seasons[0], Confirmed1=true, Confirmed2=false,Round=5, Place=stadiums[1]} ,
                new Match {Team1=teams[5], Team2=teams[2], FinalScore1 = 25, FinalScore2 = 36, Date = new DateTime(2011, 03, 25), Season = seasons[0], Confirmed1=true, Confirmed2=true, Round=6, Place=stadiums[1]},
                new Match {Team1=teams[5], Team2=teams[3], FinalScore1 = 66, FinalScore2 = 57, Date = new DateTime(2011, 07, 11), Season = seasons[0], Confirmed1=true, Confirmed2=false,Round=7, Place=stadiums[1]} ,
                new Match {Team1=teams[5], Team2=teams[6], FinalScore1 = 58, FinalScore2 = 48, Date = new DateTime(2012, 05, 12), Season = seasons[1], Confirmed1=true, Confirmed2=false,Round=7, Place=stadiums[1]},
                new Match {Team1=teams[5], Team2=teams[6], FinalScore1 = 59, FinalScore2 = 33, Date = new DateTime(2011, 03, 11), Season = seasons[0], Confirmed1=true, Confirmed2=true,Round=9, Place=stadiums[0]},
                new Match {Team1=teams[5], Team2=teams[4], FinalScore1 = 25, FinalScore2 = 31, Date = new DateTime(2011, 02, 25), Season = seasons[0], Confirmed1=true, Confirmed2=true, Round=8, Place=stadiums[1]},
                new Match {Team1=teams[6], Team2=teams[1], FinalScore1 = 29, FinalScore2 = 32, Date = new DateTime(2011, 01, 28), Season = seasons[0], Confirmed1=true, Confirmed2=true,Round=2, Place=stadiums[0]},
                 new Match {Team1=teams[2], Team2=teams[1], FinalScore1 = 51, FinalScore2 = 42, Date = new DateTime(2011, 06, 30), Season = seasons[0], Confirmed1=true, Confirmed2=true,Round=3, Place=stadiums[0]}
            };

            foreach (var m in matchs)
            {
                _db.Matchs.Add(m);
            }


            var seasonTeamPlayers = new List<SeasonTeamPlayer>
            {
                new SeasonTeamPlayer { Player = players[0],  Team=teams[0], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[1],  Team=teams[0], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[2],  Team=teams[0], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[0],  Team=teams[6], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[1],  Team=teams[5], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[2],  Team=teams[3], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[3],  Team=teams[0], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[4],  Team=teams[1], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[5],  Team=teams[1], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[6],  Team=teams[1], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[7],  Team=teams[1], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[8],  Team=teams[2], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[9],  Team=teams[2], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[9],  Team=teams[6], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[10], Team=teams[2], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[10], Team=teams[3], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[11], Team=teams[4], Season=seasons[0]},
                new SeasonTeamPlayer { Player = players[11], Team=teams[5], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[12], Team=teams[3], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[4],  Team=teams[3], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[5],  Team=teams[1], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[13], Team=teams[5], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[14], Team=teams[5], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[15],  Team=teams[5], Season=seasons[1]},
                new SeasonTeamPlayer { Player = players[16],  Team=teams[5], Season=seasons[1]},
            };
            foreach (var stp in seasonTeamPlayers)
            {
                _db.SeasonTeamPlayers.Add(stp);
            }


            var points = new List<Point>
            {
                //Pogoń season[0]
                new Point {Player=players[0],  Match = matchs[0], HalfTimeScoredPoints=7,  ScoredPoints=18},
                new Point {Player=players[0],  Match = matchs[1], HalfTimeScoredPoints=12, ScoredPoints=14},
                new Point {Player=players[0],  Match = matchs[2], HalfTimeScoredPoints=13, ScoredPoints=24},
                new Point {Player=players[0],  Match = matchs[4], HalfTimeScoredPoints=12, ScoredPoints=14},
                new Point {Player=players[1],  Match = matchs[0], HalfTimeScoredPoints=12, ScoredPoints=16},
                new Point {Player=players[1],  Match = matchs[2], HalfTimeScoredPoints=10, ScoredPoints=20},
                new Point {Player=players[2],  Match = matchs[0], HalfTimeScoredPoints=8,  ScoredPoints=10},
                new Point {Player=players[2],  Match = matchs[4], HalfTimeScoredPoints=11, ScoredPoints=12},
                new Point {Player=players[3],  Match = matchs[1], HalfTimeScoredPoints=12, ScoredPoints=15},
                //Śląsk season[0]
                new Point {Player=players[4],  Match = matchs[0], HalfTimeScoredPoints=5,  ScoredPoints=7},
                new Point {Player=players[4],  Match = matchs[2], HalfTimeScoredPoints=12, ScoredPoints=14},
                new Point {Player=players[4],  Match = matchs[3], HalfTimeScoredPoints=18, ScoredPoints=21},
                new Point {Player=players[4],  Match = matchs[5], HalfTimeScoredPoints=15, ScoredPoints=15},
                new Point {Player=players[4],  Match = matchs[6], HalfTimeScoredPoints=8,  ScoredPoints=15},
                new Point {Player=players[5],  Match = matchs[3], HalfTimeScoredPoints=7,  ScoredPoints=18},
                new Point {Player=players[6],  Match = matchs[5], HalfTimeScoredPoints=11, ScoredPoints=12},
                new Point {Player=players[7],  Match = matchs[0], HalfTimeScoredPoints=5,  ScoredPoints=15},
                new Point {Player=players[7],  Match = matchs[3], HalfTimeScoredPoints=11, ScoredPoints=19},
                //Legia season[0]
                new Point {Player=players[8],  Match = matchs[1], HalfTimeScoredPoints=7,  ScoredPoints=11},
                new Point {Player=players[8],  Match = matchs[3], HalfTimeScoredPoints=11, ScoredPoints=19},
                new Point {Player=players[8],  Match = matchs[4], HalfTimeScoredPoints=14, ScoredPoints=18},
                new Point {Player=players[8],  Match = matchs[5], HalfTimeScoredPoints=11, ScoredPoints=14},
                new Point {Player=players[8],  Match = matchs[6], HalfTimeScoredPoints=6,  ScoredPoints=12},
                new Point {Player=players[8],  Match = matchs[7], HalfTimeScoredPoints=8,  ScoredPoints=12},
                new Point {Player=players[9],  Match = matchs[3], HalfTimeScoredPoints=9,  ScoredPoints=21},
                new Point {Player=players[10], Match = matchs[5], HalfTimeScoredPoints=11, ScoredPoints=12},
                new Point {Player=players[10], Match = matchs[6], HalfTimeScoredPoints=10, ScoredPoints=12},

                new Point {Player=players[10], Match = matchs[8], HalfTimeScoredPoints=10, ScoredPoints=12},
                //Wisła season[0]
                new Point {Player=players[12], Match = matchs[7], HalfTimeScoredPoints=12, ScoredPoints=18},
                //Amika
                new Point {Player=players[13],  Match = matchs[9], HalfTimeScoredPoints=7,  ScoredPoints=11},
                new Point {Player=players[13],  Match = matchs[10], HalfTimeScoredPoints=11, ScoredPoints=19},
                new Point {Player=players[13],  Match = matchs[11], HalfTimeScoredPoints=14, ScoredPoints=18},
                new Point {Player=players[13],  Match = matchs[12], HalfTimeScoredPoints=11, ScoredPoints=14},
                new Point {Player=players[13],  Match = matchs[8], HalfTimeScoredPoints=11, ScoredPoints=22},
                new Point {Player=players[13],  Match = matchs[13], HalfTimeScoredPoints=6,  ScoredPoints=12},
                new Point {Player=players[13],  Match = matchs[14], HalfTimeScoredPoints=8,  ScoredPoints=12},
                new Point {Player=players[13],  Match = matchs[15], HalfTimeScoredPoints=9,  ScoredPoints=21},
                new Point {Player=players[14],  Match = matchs[14], HalfTimeScoredPoints=12, ScoredPoints=12},
                new Point {Player=players[14],  Match = matchs[15], HalfTimeScoredPoints=10, ScoredPoints=12},
            };
            foreach (var p in points) _db.Points.Add(p);

            var fauls = new List<Faul>
            {
                //Pogoń season[0]
                new Faul {Player=players[0], Match = matchs[0], FaulsCommited=0},
                new Faul {Player=players[0], Match = matchs[1], FaulsCommited=1},
                new Faul {Player=players[0], Match = matchs[2], FaulsCommited=2},
                new Faul {Player=players[0], Match = matchs[4], FaulsCommited=0},
                new Faul {Player=players[1], Match = matchs[0], FaulsCommited=1},
                new Faul {Player=players[1], Match = matchs[2], FaulsCommited=1},
                new Faul {Player=players[2], Match = matchs[0], FaulsCommited=4},
                new Faul {Player=players[2], Match = matchs[4], FaulsCommited=3},
                new Faul {Player=players[3], Match = matchs[1], FaulsCommited=0},
                //Śląsk season[0]
                new Faul {Player=players[4], Match = matchs[0], FaulsCommited=0},
                new Faul {Player=players[4], Match = matchs[2], FaulsCommited=0},
                new Faul {Player=players[4], Match = matchs[3], FaulsCommited=1},
                new Faul {Player=players[4], Match = matchs[5], FaulsCommited=0},
                new Faul {Player=players[4], Match = matchs[6], FaulsCommited=2},
                new Faul {Player=players[5], Match = matchs[3], FaulsCommited=0},
                new Faul {Player=players[6], Match = matchs[5], FaulsCommited=0},
                new Faul {Player=players[7], Match = matchs[0], FaulsCommited=4},
                new Faul {Player=players[7], Match = matchs[3], FaulsCommited=1},
                //Legia season[0]
                new Faul {Player=players[8], Match = matchs[1], FaulsCommited=0},
                new Faul {Player=players[8], Match = matchs[3], FaulsCommited=1},
                new Faul {Player=players[8], Match = matchs[4], FaulsCommited=0},
                new Faul {Player=players[8], Match = matchs[5], FaulsCommited=3},
                new Faul {Player=players[8], Match = matchs[6], FaulsCommited=2},
                new Faul {Player=players[8], Match = matchs[7], FaulsCommited=0},
                //Wisła season[0]
                new Faul {Player=players[12], Match= matchs[7], FaulsCommited=2},
                //Amika
                new Faul {Player=players[13],  Match = matchs[9], FaulsCommited=0},
                new Faul {Player=players[13],  Match = matchs[10], FaulsCommited=1},
                new Faul {Player=players[13],  Match = matchs[11], FaulsCommited=0},
                new Faul {Player=players[13],  Match = matchs[12], FaulsCommited=3},
                new Faul {Player=players[13],  Match = matchs[13], FaulsCommited=2},
                new Faul {Player=players[13],  Match = matchs[14], FaulsCommited=0},
                new Faul {Player=players[13],  Match = matchs[15], FaulsCommited=2},
                new Faul {Player=players[14],  Match = matchs[14], FaulsCommited=0},
                new Faul {Player=players[14],  Match = matchs[14], FaulsCommited=0}
            };
            foreach (var f in fauls) _db.Fauls.Add(f);

            var minutes = new List<Minute>
            {
                //Pogoń season[0]
                new Minute {Player=players[0], Match = matchs[0], MinutesPlayed=11},
                new Minute {Player=players[0], Match = matchs[1], MinutesPlayed=12},
                new Minute {Player=players[0], Match = matchs[2], MinutesPlayed=23},
                new Minute {Player=players[0], Match = matchs[4], MinutesPlayed=42},
                new Minute {Player=players[1], Match = matchs[0], MinutesPlayed=11},
                new Minute {Player=players[1], Match = matchs[2], MinutesPlayed=12},
                new Minute {Player=players[2], Match = matchs[0], MinutesPlayed=43},
                new Minute {Player=players[2], Match = matchs[4], MinutesPlayed=34},
                new Minute {Player=players[3], Match = matchs[1], MinutesPlayed=25},
                //Śląsk season[0]
                new Minute {Player=players[4], Match = matchs[0], MinutesPlayed=15},
                new Minute {Player=players[4], Match = matchs[2], MinutesPlayed=11},
                new Minute {Player=players[4], Match = matchs[3], MinutesPlayed=15},
                new Minute {Player=players[4], Match = matchs[5], MinutesPlayed=16},
                new Minute {Player=players[4], Match = matchs[6], MinutesPlayed=22},
                new Minute {Player=players[5], Match = matchs[3], MinutesPlayed=25},
                new Minute {Player=players[6], Match = matchs[5], MinutesPlayed=29},
                new Minute {Player=players[7], Match = matchs[0], MinutesPlayed=11},
                new Minute {Player=players[7], Match = matchs[3], MinutesPlayed=30},
                //Legia season[0]
                new Minute {Player=players[8], Match = matchs[1], MinutesPlayed=40},
                new Minute {Player=players[8], Match = matchs[3], MinutesPlayed=31},
                new Minute {Player=players[8], Match = matchs[4], MinutesPlayed=20},
                new Minute {Player=players[8], Match = matchs[5], MinutesPlayed=23},
                new Minute {Player=players[8], Match = matchs[6], MinutesPlayed=12},
                new Minute {Player=players[8], Match = matchs[7], MinutesPlayed=34},
                //Wisła season[0]
                new Minute {Player=players[12], Match= matchs[7], MinutesPlayed=22},
                //Amika
                new Minute {Player=players[13],  Match = matchs[9], MinutesPlayed=11},
                new Minute {Player=players[13],  Match = matchs[10], MinutesPlayed=16},
                new Minute {Player=players[13],  Match = matchs[11], MinutesPlayed=30},
                new Minute {Player=players[13],  Match = matchs[12], MinutesPlayed=32},
                new Minute {Player=players[13],  Match = matchs[13], MinutesPlayed=22},
                new Minute {Player=players[13],  Match = matchs[14], MinutesPlayed=20},
                new Minute {Player=players[13],  Match = matchs[15], MinutesPlayed=12},
                new Minute {Player=players[14],  Match = matchs[14], MinutesPlayed=40},
                new Minute {Player=players[14],  Match = matchs[14], MinutesPlayed=11},

                new Minute {Player=players[10], Match = matchs[8], MinutesPlayed=34}
            };
            foreach (var m in minutes) _db.Minutes.Add(m);


            
            var announcedPlayers = new List<AnnouncedPlayer>
            {
                new AnnouncedPlayer { Name = "Jenna", Surname="Jenkins", Email="JJ@xyz.com", Confirmed=false, InDatabase=false},
                new AnnouncedPlayer { Name = "Piotr", Surname="Skarga", Email="pskarga@gmial.com", Confirmed=false, InDatabase=false},
            };


            var announceCommunicateStatuses = new List<AnnounceCommunicateStatus>
            {
                new AnnounceCommunicateStatus { AnnounceCommunicateStatusId=0, Status="Posted"},
                new AnnounceCommunicateStatus { AnnounceCommunicateStatusId=1, Status="Confirmed"}
            };
            foreach (var acs in announceCommunicateStatuses)
            {
                _db.AnnounceCommunicateStatuses.Add(acs);
            }

            var announceCommunicates = new List<AnnounceCommunicate>
            {
                new AnnounceCommunicate { AnnounceDate=DateTime.Now, ChefPlayerIndex=0, Players=announcedPlayers, Status = announceCommunicateStatuses[0], TeamName="Figole"}
            };

            foreach (var ac in announceCommunicates)
            {
                _db.AnnounceCommunicates.Add(ac);
            }

            var communicates = new List<Communicate>
            {
                new Communicate { Sender = teams[0].ChefPlayer.UserName, Receiver=teams[2].ChefPlayer.UserName, 
                    Content="Wprowadzono wynik meczu " + matchs[4].Team1.TeamName + " vs " + matchs[4].Team2.TeamName
                    + " (" + matchs[4].FinalScore1 + " : " + matchs[4].FinalScore2 + ")", Type=0, Date = new DateTime(2012, 04, 28) },
                new Communicate { Sender = teams[2].ChefPlayer.UserName, Receiver=teams[1].ChefPlayer.UserName, 
                    Content="Wprowadzono wynik meczu " + matchs[5].Team1.TeamName + " vs " + matchs[5].Team2.TeamName
                    + " (" + matchs[5].FinalScore1 + " : " + matchs[5].FinalScore2 + ")", Type=0, Date = new DateTime(2012, 05, 30) }
            };
            foreach (var c in communicates)
            {
                _db.Communicates.Add(c);
            }

            var categories = new List<NewsCategory>
            {
                new NewsCategory {
                    categoryName = "Relacje pomeczowe"
                },
                new NewsCategory {
                    categoryName = "Ważne ogłoszenia"
                },
                new NewsCategory {
                    categoryName = "Spotkania integracyjne"
                },
                new NewsCategory {
                    categoryName = "Nowy trener"
                }
            };

            foreach (var category in categories)
            {
                _db.NewsCategories.Add(category);
            }

            var newses = new List<News>
            {
                new News {
                    newsTitle = "Nowy stadion na Wyszyńskiego",
                    newsContent = "W dniu wczorajszym otwarto nowy stadion na ulicy Wyszyńskiego, przy Szkole Podstawowej nr 8. Prezydent miasta, Wlodzimierz Rzepa liczy na wzrost zainteresowania młodzieży sportem.",
                    newsCategory = categories[1],
                    newsDate = DateTime.Now,
                    newsActive = true
                },

                new News {
                    newsTitle = "Wieczorek nowym trenerem Śląska",
                    newsContent = "W dniu wczorajszym Marcin Wieczorek zastąpił Łukasza Magierę na stanowisku trenera zespołu Śląsk. Kibice mają nadzieję na wzrost efektywności gry drużyny.",
                    newsCategory = categories[3],
                    newsDate = DateTime.Now,
                    newsActive = true
                },

                new News {
                    newsTitle = "News niewidoczny - tytuł",
                    newsContent = "News niewidoczny - treśćwłaściwa.",
                    newsCategory = categories[2],
                    newsDate = DateTime.Now,
                    newsActive = false
                }

            };

            foreach (var news in newses)
            {
                _db.Newses.Add(news);
            }

            var comments = new List<NewsComment>
            {
                new NewsComment {
                    commentActive = true,
                    commentAuthor = players[1],
                    commentDate = DateTime.Now,
                    commentNews = newses[0],
                    commentContent = "To świetna wiadomość! Już nie mogę się doczekać naszego najbliższego spotkania na nowym obiekcie! :)"
                },
            };

            foreach (var comment in comments)
            {
                _db.NewsComments.Add(comment);
            }

            var adverts = new List<Advert>
            {
                new Advert {
                    advertActive = true,
                    advertContent = "Szukam zespołu! Ktoś chętny???",
                    advertDate = DateTime.Now,
                    advertMail = "CC@xyz.com",
                    advertTitle = "Szukam zespołu"
                },
            };
            
            foreach (var advert in adverts)
            {
                _db.Adverts.Add(advert);
            }
        }
    }
}